Click-Through Parameters
Appending Additional Values to Product URLs
You can add parameters to the links used when a customer clicks on a recommendation. Query string parameters fall into two main categories: static and dynamic.
Static
Static query string parameters will be consistent in all renderings of the layout and do not need the key or value to be supplied by the integration code. Static values will be set up by your Algonomy technical contact.
The landing page URL might look like this, where campaign=rr is a unchanging value for all recommendations:
http://yourstore.com/product/1234?campaign=rr
Dynamic
Dynamic parameters are values that can differ from one recommendation set to another and require a little coordination with your Algonomy technical contact and front-end development team. The code changes required in the site integration is to include an addClickthruParams() call specifying the index to append at and the exact value to append.
JavaScript Integration
How To Incorporate Parameters and Values into Recommendations
To incorporate the passed in parameters and values into recommendations adding the following placeholder/variables to the layout for the placement requested is necessary:
Static
Static parameters are values that are set in instrumentation and are the same for each recommendation/ad/promotion link on a page.
If you set the clickthru value in the JavaScript instrumentation to this:
R3_COMMON.addClickthruParams(0, 'origin=CJ&campaign=rr');
The landing page URL will look like this:
http://www.yoursite.com/product/1234?origin=CJ&campaign=rr
Dynamic
Dynamic parameters are values that can differ from one recommendation set to another and require a little coordination with your Integration Engineer.
Let's say the metrics team wants to track clicks on {rr} recommendations on two different design treatments of a page (for example, 'treatment'), the value of the origin into the site (for example, 'origin'), what strategy caused the customer to click on it (for example, 'rrStrat'), and which item slot was clicked on (for example, 'rrItem').
For example, if you set the clickthru value in the JavaScript instrumentation to this:
R3_COMMON.addClickthruParams(0, treatment=home_a&origin=google');
and your {rr} Integration Engineer sets up the recommendations-based data points (strategy, placement index, item index) in the dashboard to append the recommendation-level data to your click-through parameter, then the landing page URL will look like this:
http://www.yoursite.com/product/1234?treatment=home_a&origin=google&rrStrat=TopSellers&rrItem=3
How to make this code work for you?
Add the following lines of code to your page tags, adding the required information to them:
Function |
Requirement |
---|---|
R3_COMMON.addClickthruParams(Index,'String'); |
Replace Index with the index for the querystring parameter; in other words, in what order it should appear in the URL. Replace String with the parameter string you need inserted. This should be in the format "key=value" (i.e., "country=china") |
Sample Code
Call addClickthruParams() in the Primary Code Block.
Primary Code Block
<!-- Place this code inside the <body> element as close to the top as possible -->
<script charset="utf-8" type="text/javascript">
var R3_COMMON = new r3_common();
R3_COMMON.setApiKey('abcd5432e1');
R3_COMMON.setBaseUrl(window.location.protocol+'//integration.richrelevance.com/rrserver/');
R3_COMMON.setClickthruServer(window.location.protocol+"//"+window.location.host);
R3_COMMON.setSessionId('6B4D397B');
R3_COMMON.setUserId('10987'); // if no user ID is available, please leave this blank
// Use this code if you are not requesting placement(s) for personalization
R3_COMMON.addPlacementType('home_page');
// Replace placement_name with the placement name you set up in Dashboard.
// Call multiple times to display more than one placement.
R3_COMMON.addPlacementType('home_page.placement_name');
// Set the first parameter in the querystring to "campaign=RR"
R3_COMMON.addClickthruParams(0, 'campaign=RR’);
var R3_HOME = new r3_home();
rr_flush_onload();
r3();
</script>